package com.epam.diplom.managedbean;

import java.io.Serializable;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component(value = "login")
@Scope("session")
public class LoginManagedBean implements Serializable {

	private static final long serialVersionUID = 1L;

	private String name;
	private String password;
	
	public LoginManagedBean() {
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public void login() {
//		FacesContext context = FacesContext.getCurrentInstance();
//		if ("admin".equals(name) && "admin".equals(password)) {
//			context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,"Sample error message", "PrimeFaces makes no mistakes"));
//		} 
	}
}
